<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Commands::Install</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Commands::Install</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/rails/railties/lib/commands/plugin_rb.html">
                vendor/rails/railties/lib/commands/plugin.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M002282">determine_install_method</a>&nbsp;&nbsp;
      <a href="#M002280">new</a>&nbsp;&nbsp;
      <a href="#M002281">options</a>&nbsp;&nbsp;
      <a href="#M002283">parse!</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M002280" class="method-detail">
        <a name="M002280"></a>

        <div class="method-heading">
          <a href="#M002280" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(base_command)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M002280-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M002280-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 751</span>
751:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">base_command</span>)
752:       <span class="ruby-ivar">@base_command</span> = <span class="ruby-identifier">base_command</span>
753:       <span class="ruby-ivar">@method</span> = <span class="ruby-identifier">:http</span>
754:       <span class="ruby-ivar">@options</span> = { <span class="ruby-identifier">:quiet</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">:revision</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:force</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span> }
755:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M002282" class="method-detail">
        <a name="M002282"></a>

        <div class="method-heading">
          <a href="#M002282" class="method-signature">
          <span class="method-name">determine_install_method</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M002282-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M002282-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 787</span>
787:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">determine_install_method</span>
788:       <span class="ruby-identifier">best</span> = <span class="ruby-ivar">@base_command</span>.<span class="ruby-identifier">environment</span>.<span class="ruby-identifier">best_install_method</span>
789:       <span class="ruby-ivar">@method</span> = <span class="ruby-identifier">:http</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">best</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:http</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@method</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:export</span>
790:       <span class="ruby-keyword kw">case</span>
791:       <span class="ruby-keyword kw">when</span> (<span class="ruby-identifier">best</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:http</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@method</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">:http</span>)
792:         <span class="ruby-identifier">msg</span> = <span class="ruby-value str">&quot;Cannot install using subversion because `svn' cannot be found in your PATH&quot;</span>
793:       <span class="ruby-keyword kw">when</span> (<span class="ruby-identifier">best</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:export</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-ivar">@method</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">:export</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@method</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">:http</span>))
794:         <span class="ruby-identifier">msg</span> = <span class="ruby-node">&quot;Cannot install using #{@method} because this project is not under subversion.&quot;</span>
795:       <span class="ruby-keyword kw">when</span> (<span class="ruby-identifier">best</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">:externals</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@method</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:externals</span>)
796:         <span class="ruby-identifier">msg</span> = <span class="ruby-value str">&quot;Cannot install using externals because vendor/plugins is not under subversion.&quot;</span>
797:       <span class="ruby-keyword kw">end</span>
798:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">msg</span>
799:         <span class="ruby-identifier">puts</span> <span class="ruby-identifier">msg</span>
800:         <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
801:       <span class="ruby-keyword kw">end</span>
802:       <span class="ruby-ivar">@method</span>
803:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M002281" class="method-detail">
        <a name="M002281"></a>

        <div class="method-heading">
          <a href="#M002281" class="method-signature">
          <span class="method-name">options</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M002281-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M002281-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 757</span>
757:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options</span>
758:       <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span>
759:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">set_summary_indent</span>(<span class="ruby-value str">'  '</span>)
760:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">banner</span> =    <span class="ruby-node">&quot;Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]&quot;</span>
761:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">define_head</span> <span class="ruby-value str">&quot;Install one or more plugins.&quot;</span>
762:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span>   <span class="ruby-value str">&quot;&quot;</span>
763:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span>   <span class="ruby-value str">&quot;Options:&quot;</span>
764:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(         <span class="ruby-value str">&quot;-x&quot;</span>, <span class="ruby-value str">&quot;--externals&quot;</span>, 
765:                       <span class="ruby-value str">&quot;Use svn:externals to grab the plugin.&quot;</span>, 
766:                       <span class="ruby-value str">&quot;Enables plugin updates and plugin versioning.&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@method</span> = <span class="ruby-identifier">:externals</span> }
767:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(         <span class="ruby-value str">&quot;-o&quot;</span>, <span class="ruby-value str">&quot;--checkout&quot;</span>,
768:                       <span class="ruby-value str">&quot;Use svn checkout to grab the plugin.&quot;</span>,
769:                       <span class="ruby-value str">&quot;Enables updating but does not add a svn:externals entry.&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@method</span> = <span class="ruby-identifier">:checkout</span> }
770:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(         <span class="ruby-value str">&quot;-e&quot;</span>, <span class="ruby-value str">&quot;--export&quot;</span>,
771:                       <span class="ruby-value str">&quot;Use svn export to grab the plugin.&quot;</span>,
772:                       <span class="ruby-value str">&quot;Exports the plugin, allowing you to check it into your local repository. Does not enable updates, or add an svn:externals entry.&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@method</span> = <span class="ruby-identifier">:export</span> }
773:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(         <span class="ruby-value str">&quot;-q&quot;</span>, <span class="ruby-value str">&quot;--quiet&quot;</span>,
774:                       <span class="ruby-value str">&quot;Suppresses the output from installation.&quot;</span>,
775:                       <span class="ruby-value str">&quot;Ignored if -v is passed (./script/plugin -v install ...)&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:quiet</span>] = <span class="ruby-keyword kw">true</span> }
776:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(         <span class="ruby-value str">&quot;-r REVISION&quot;</span>, <span class="ruby-value str">&quot;--revision REVISION&quot;</span>,
777:                       <span class="ruby-value str">&quot;Checks out the given revision from subversion or git.&quot;</span>,
778:                       <span class="ruby-value str">&quot;Ignored if subversion/git is not used.&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:revision</span>] = <span class="ruby-identifier">v</span> }
779:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(         <span class="ruby-value str">&quot;-f&quot;</span>, <span class="ruby-value str">&quot;--force&quot;</span>,
780:                       <span class="ruby-value str">&quot;Reinstalls a plugin if it's already installed.&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:force</span>] = <span class="ruby-keyword kw">true</span> }
781:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span>   <span class="ruby-value str">&quot;&quot;</span>
782:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span>   <span class="ruby-value str">&quot;You can specify plugin names as given in 'plugin list' output or absolute URLs to &quot;</span>
783:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span>   <span class="ruby-value str">&quot;a plugin repository.&quot;</span>
784:       <span class="ruby-keyword kw">end</span>
785:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M002283" class="method-detail">
        <a name="M002283"></a>

        <div class="method-heading">
          <a href="#M002283" class="method-signature">
          <span class="method-name">parse!</span><span class="method-args">(args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M002283-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M002283-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 805</span>
805:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">args</span>)
806:       <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">args</span>)
807:       <span class="ruby-identifier">environment</span> = <span class="ruby-ivar">@base_command</span>.<span class="ruby-identifier">environment</span>
808:       <span class="ruby-identifier">install_method</span> = <span class="ruby-identifier">determine_install_method</span>
809:       <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Plugins will be installed using #{install_method}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$verbose</span>
810:       <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
811:         <span class="ruby-operator">::</span><span class="ruby-constant">Plugin</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">install</span>(<span class="ruby-identifier">install_method</span>, <span class="ruby-ivar">@options</span>)
812:       <span class="ruby-keyword kw">end</span>
813:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
814:       <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Plugin not found: #{args.inspect}&quot;</span>
815:       <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$verbose</span>
816:       <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
817:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>